import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ServerThreadPoolExecutor {
    ExecutorService pool = null;

    public ServerThreadPoolExecutor(int maxPoolSize, int queueSize) {
        this.pool = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), maxPoolSize, 120,
                TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(queueSize));
    }

    public void execute(ServerSocketHandler handler) {
        pool.execute(handler);
    }
}
